﻿using System; 
using System.Data; 
using Besture.Bll;
using Besture.Bll.UserBase;
using Besture.Model;
using Besture.UI.Common;
using Besture.Common;

namespace Besture.UI.Portal.UserCenter
{
    public partial class OrderDetail : UserPage
    {
        public DataTable DtPassengerOrder = new DataTable();
        public OrderModel OrderMode = new OrderModel();
        public string SHotels = string.Empty;
        public string SRoom = string.Empty;
        public string SOrderStatusName = string.Empty;//支付情况
        public string SPayMethod = string.Empty;//预定方式
        public string sReservationNumber = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                OrderMode = new OrderDac().GetModel(Convert.ToInt32(StringHelper.Query("id")));
                if (OrderMode != null)
                {

                    DtPassengerOrder =
                        new PassengerOrderDac().GetDataTableByOrderId(Convert.ToInt32(StringHelper.Query("id")));
                    var v =
                        QueryDac.GetTable(string.Format("select * from TBDictionaryType where Type=7 and Code={0}",
                            OrderMode.OrderStatus));
                    SOrderStatusName = v.Rows.Count > 0 ? v.Rows[0]["Name"].ToString() : "";
                    // SPayMethod = 
                    SHotels = new HotelsDac().GetModel(OrderMode.HotelsID) != null
                        ? new HotelsDac().GetModel(OrderMode.HotelsID).HotelsName
                        : "";
                    SRoom = new RoomDac().GetModel(OrderMode.RoomID) != null
                        ? new RoomDac().GetModel(OrderMode.RoomID).RoomName
                        : "";
                    sReservationNumber = OrderMode.ReservationNumber;
                }
            }
        }

        public string GetOrderStatus(int code)
        {
            //订单状态
            var v = QueryDac.GetTable(string.Format("select * from TBDictionaryType where Type=7 and code={0}", code));
            if (v != null)
                return v.Rows[0]["Name"].ToString();
            return "";
        }
    }
}